/*
package com.jinxin.phonecloudmusic.myapplication.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

import com.jinxin.phonecloudmusic.myapplication.R;
import com.jinxin.phonecloudmusic.myapplication.adapter.MusicSearchSingerAdapter;
import com.jinxin.phonecloudmusic.myapplication.adapter.MusicSearchSongAdapter;
import com.jinxin.phonecloudmusic.myapplication.base.BaseFragment;
import com.jinxin.phonecloudmusic.myapplication.entity.GroupBean.Search;
import com.jinxin.phonecloudmusic.myapplication.entity.MusicBean.Song;
import com.jinxin.phonecloudmusic.myapplication.event.MusicControlEvent;
import com.jinxin.phonecloudmusic.myapplication.utils.RxBus;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;

*/
/**
 * Created by ZJ on 2017/10/13 0013.
 * 单曲（搜索）
 *//*


public class SearchMusicSongFragment extends BaseFragment{
    @BindView(R.id.lv_music_search_song)
    ListView lvMusicSearchSong;

    private Search search;
    private List<Song> singers=new ArrayList<>();

    private MusicSearchSongAdapter musicSearchSongAdapter;

    private int pos;

    @Override
    public View inflate(LayoutInflater inflater, ViewGroup container) {
        return inflater.inflate(R.layout.fra_music_search_song, container, false);
    }

    @Override
    public void initData() {
        RxBus.getDefault().register(MusicControlEvent.class).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<MusicControlEvent>() {
            @Override
            public void accept(MusicControlEvent event) throws Exception {
                if (((int)event.getTag()) == 20) {//20:搜索结果
                    search= (Search) event.getObj1();
                    singers=search.getSongList();
                    //适配数据
                    if (null==musicSearchSongAdapter){
                        musicSearchSongAdapter=new MusicSearchSongAdapter(getActivity(),R.layout.item_music_search_song,singers);
                    }else {
                        musicSearchSongAdapter.replaceAll(singers);
                    }
                    if (null!=lvMusicSearchSong) {
                        lvMusicSearchSong.setAdapter(musicSearchSongAdapter);
                        lvMusicSearchSong.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                                pos = position;
//                                Intent intent = new Intent(getActivity(), MusicPlayAcitivity.class);
//                                Bundle bundle = new Bundle();
//                                bundle.putSerializable("singer", (Serializable) singers);
//                                bundle.putInt("singerPos", position);
//                                intent.putExtras(bundle);
//                                startActivity(intent);
                            }
                        });
                    }
                }
            }
        });
    }
}
*/
